﻿<pluginView:DslPluginMainControl x:Class="$LanguageNamespace$.MainViewControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="558" 
             TextOptions.TextFormattingMode="Display"             
             
             xmlns:pluginView ="clr-namespace:$LanguageNamespace$.View"
             

             xmlns:attached="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.Attached;assembly=Tum.PDE.ToolFramework.Modeling.Visualization"
             xmlns:converters="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Converters;assembly=Tum.PDE.ToolFramework.Modeling.Visualization"
             xmlns:commands="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Commands;assembly=Tum.PDE.ToolFramework.Modeling.Visualization"
             xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
             xmlns:ribbonHelper="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.Ribbon;assembly=Tum.PDE.ToolFramework.Modeling.Visualization"
             xmlns:ribbonHelperBase="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon;assembly=Tum.PDE.ToolFramework.Modeling.Visualization.Base"
             xmlns:shellCommonCtrls="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Shell.Controls.Common;assembly=Tum.PDE.ToolFramework.Modeling.Visualization.Shell">
 <pluginView:DslPluginMainControl.Resources>
    <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources.xaml"/>
            </ResourceDictionary.MergedDictionaries>


            <!-- Converters -->
            <converters:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            <converters:ICollectionToVisibilityConverter x:Key="CollectionToVisibilityConverter"/>

            <!-- Default commands -->
            <commands:CommandReference x:Key="DeleteCommandRef" Command="{Binding Path=ActiveViewModel.DeleteCommand}"/>
            <commands:CommandReference x:Key="CutDeleteCommandRef" Command="{Binding Path=ActiveViewModel.CutCommand}"/>
            <commands:CommandReference x:Key="CopyCommandRef" Command="{Binding Path=ActiveViewModel.CopyCommand}"/>
            <commands:CommandReference x:Key="PasteCommandRef" Command="{Binding Path=ActiveViewModel.PasteCommand}"/>
            <commands:CommandReference x:Key="UndoCommandRef" Command="{Binding Path=ActiveViewModel.UndoCommand}"/>
            <commands:CommandReference x:Key="RedoCommandRef" Command="{Binding Path=ActiveViewModel.RedoCommand}"/>
            <commands:CommandReference x:Key="SaveModelCommandRef" Command="{Binding Path=SaveModelCommand}"/>
        </ResourceDictionary>
    </pluginView:DslPluginMainControl.Resources>
    <pluginView:DslPluginMainControl.InputBindings>
        <!--<KeyBinding Command="{StaticResource DeleteCommandRef}" Key="Delete"/>

        <KeyBinding Command="{StaticResource CutDeleteCommandRef}" Key="X" Modifiers="Control"/>
        <KeyBinding Command="{StaticResource CopyCommandRef}" Key="C" Modifiers="Control"/>
        <KeyBinding Command="{StaticResource PasteCommandRef}" Key="V" Modifiers="Control"/>-->

        <KeyBinding Command="{StaticResource UndoCommandRef}" Key="Z" Modifiers="Control"/>
        <KeyBinding Command="{StaticResource RedoCommandRef}" Key="Y" Modifiers="Control"/>

        <KeyBinding Command="{StaticResource SaveModelCommandRef}" Key="S" Modifiers="Control"/>
    </pluginView:DslPluginMainControl.InputBindings>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ribbonHelper:EmbeddedRibbon Grid.Row="0" x:Name="ribbonControl">
            <!-- Tab: Home -->
            <fluent:RibbonTabItem Header="Home">
                <fluent:RibbonGroupBox Header="Common">
                    <fluent:Button Text="Delete" Command="{Binding Path=ActiveViewModel.DeleteCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Delete-32.png" SizeDefinition="Large">
                        <fluent:Button.ToolTip>
                            <fluent:ScreenTip Title="Delete (Del)" Text="Delete the selected content." Width="190"/>
                        </fluent:Button.ToolTip>
                    </fluent:Button>
                    <fluent:Button Text="Cut" Command="{Binding Path=ActiveViewModel.CutCommand, Mode=OneWay}" Icon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Cut-16.png" SizeDefinition="Middle" >
                        <fluent:Button.ToolTip>
                            <fluent:ScreenTip Title="Cut (Ctrl+C)" Text="Cut the contents to the Clipboard." Width="190"/>
                        </fluent:Button.ToolTip>
                    </fluent:Button>
                    <fluent:Button Text="Copy" Command="{Binding Path=ActiveViewModel.CopyCommand, Mode=OneWay}" Icon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Copy-16.png" SizeDefinition="Middle">
                        <fluent:Button.ToolTip>
                            <fluent:ScreenTip Title="Copy (Ctrl+C)" Text="Copy the contents to the Clipboard." Width="190"/>
                        </fluent:Button.ToolTip>
                    </fluent:Button>
                    <fluent:Button Text="Paste" Command="{Binding Path=ActiveViewModel.PasteCommand, Mode=OneWay}" Icon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Paste-16.png" SizeDefinition="Middle" >
                        <fluent:Button.ToolTip>
                            <fluent:ScreenTip Title="Paste (Ctrl+V)" Text="Paste the contents of the Clipboard." Width="190"/>
                        </fluent:Button.ToolTip>
                    </fluent:Button>
                </fluent:RibbonGroupBox>
                <fluent:RibbonGroupBox Header="Commands">
                    <fluent:Button Text="Undo" Command="{Binding Path=ActiveViewModel.UndoCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Undo-32.png" SizeDefinition="Large">
                        <fluent:Button.ToolTip>
                            <fluent:ScreenTip Title="Undo (Ctrl+Z)" Text="Undo last action." Width="190"/>
                        </fluent:Button.ToolTip>
                    </fluent:Button>
                    <fluent:Button Text="Redo" Command="{Binding Path=ActiveViewModel.RedoCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Redo-32.png" SizeDefinition="Large">
                        <fluent:Button.ToolTip>
                            <fluent:ScreenTip Title="Redo (Ctrl+Y)" Text="Redo last undone action." Width="190"/>
                        </fluent:Button.ToolTip>
                    </fluent:Button>
                </fluent:RibbonGroupBox>
                <fluent:RibbonGroupBox Header="Navigation">
                    <fluent:Button Text="Back" Command="{Binding Path=NavigateBackwardCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Back-32.png" SizeDefinition="Large"/>
                    <fluent:Button Text="Forward" Command="{Binding Path=NavigateForwardCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Forward-32.png" SizeDefinition="Large"/>
                </fluent:RibbonGroupBox>

                <!-- View items: For the default views-->
                <fluent:RibbonGroupBox Header="View">
                    <fluent:ToggleButton Text="Model Tree" Command="{Binding Path=ShowModelTreeCommand}" Margin="2,0,0,0" IsChecked="{Binding ModelTreeModel.IsDockingPaneVisible, Mode=TwoWay}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/ModelTree-32.png" SizeDefinition="Large"/>
                    <fluent:ToggleButton Text="Property Window" Command="{Binding Path=ShowPropertiesCommand}" Margin="2,0,0,0" IsChecked="{Binding PropertyGridModel.IsDockingPaneVisible, Mode=TwoWay}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/PropertyGrid-32.png" SizeDefinition="Large"/>
                    <fluent:ToggleButton Text="Error List" Command="{Binding Path=ShowErrorListCommand}" Margin="2,0,0,0" IsChecked="{Binding ErrorListModel.IsDockingPaneVisible, Mode=TwoWay}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/ErrorList-32.png" SizeDefinition="Large"/>
                    <fluent:ToggleButton Text="Dependencies   " Command="{Binding Path=ShowDependenciesCommand}" Margin="2,0,0,0" IsChecked="{Binding DependenciesModel.IsDockingPaneVisible, Mode=TwoWay}" Icon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Refresh-16.png" SizeDefinition="Middle"/>
                    <fluent:ToggleButton Text="Diagram Surface" Command="{Binding Path=ShowDiagramSurfaceCommand}" Margin="2,2,0,0" IsChecked="{Binding SelectedModelContextViewModel.DiagramSurfaceModel.IsDockingPaneVisible, Mode=TwoWay}" Icon="/Tum.PDE.ToolFramework.Images;component/Ribbon/DiagramSurface-16.png" SizeDefinition="Middle" />
                </fluent:RibbonGroupBox>

                <!-- Validation -->
                <fluent:RibbonGroupBox Header="Validation" Visibility="{Binding IsValidationMenuVisible, Mode=OneTime, Converter={StaticResource BooleanToVisibilityConverter}}">
                    <fluent:Button Text="Validate" Command="{Binding Path=ActiveViewModel.ValidateCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Validate-32.png" SizeDefinition="Large"/>
                    <fluent:Button Text="Validate All" Command="{Binding Path=ValidateAllCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/ValidateAll-32.png" SizeDefinition="Large"/>
                </fluent:RibbonGroupBox>

                <!-- Languages -->
                <!--
                <fluent:RibbonGroupBox Header="Languages" DataContext="{Binding Path=LanguagesViewModel}">
                    <fluent:ComboBox ItemsSource="{Binding Path=Languages, Mode=OneWay}" Width="200" Height="23" HorizontalAlignment="Stretch"
                                      SelectedItem="{Binding Path=SelectedLanguage, Mode=TwoWay}" Text="Language"
                                      IsReadOnly="True"
                                      DisplayMemberPath="DisplayName"/>
                </fluent:RibbonGroupBox>-->
            </fluent:RibbonTabItem>

            <!-- Tab: Edit -->
            <fluent:RibbonTabItem Header="Edit" DataContext="{Binding Path=SearchModel}">
                <fluent:RibbonGroupBox Header="Find Advanced">
                    <fluent:Button Text="Find Advanced" Command="{Binding Path=SearchAdvancedCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/SearchAdvanced-32.png" SizeDefinition="Large"/>
                    <!--<fluent:Button Text="Find and Replace" Command="{Binding Path=SearchAndReplaceCommand}" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/FindAndReplace-32.png" SizeDefinition="Large" />                    -->
                </fluent:RibbonGroupBox>
                <fluent:RibbonGroupBox Header="Quick Find">
                    <TextBox Text="{Binding Path=SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="250" Margin="0,0,0,1">
                        <TextBox.InputBindings>
                            <KeyBinding Key="Enter" Command="{Binding Path=SearchCommand}"/>
                        </TextBox.InputBindings>
                    </TextBox>
                    <fluent:ComboBox ItemsSource="{Binding Path=SearchSource, Mode=OneWay}" Width="250" Height="23" HorizontalAlignment="Stretch"
                                      SelectedItem="{Binding Path=SelectedSearchSource, Mode=TwoWay}" Text="Find where "
                                      IsReadOnly="True"
                                      DisplayMemberPath="DisplayName"/>
                    <fluent:ComboBox ItemsSource="{Binding Path=SearchCriteria, Mode=OneWay}" Width="250" Height="23" HorizontalAlignment="Stretch"
                                      SelectedItem="{Binding Path=SelectedSearchCriteria, Mode=TwoWay}" Text="Find criteria"
                                      IsReadOnly="True"
                                      DisplayMemberPath="DisplayName"/>
                    <fluent:Button Text="Find" Command="{Binding Path=SearchCommand}" HorizontalAlignment="Right" LargeIcon="/Tum.PDE.ToolFramework.Images;component/Ribbon/Search-32.png" SizeDefinition="Large"/>
                </fluent:RibbonGroupBox>
            </fluent:RibbonTabItem>

            <!-- Tab: View -->
            <fluent:RibbonTabItem Header="View">
                <!-- Additional Views -->
                <fluent:RibbonGroupBox Header="Additional Views" Visibility="{Binding Path=SelectedModelContextViewModel.HasAdditionalDiagramSurfaceModels, Mode=OneTime, Converter={StaticResource BooleanToVisibilityConverter}}">
                    <fluent:InRibbonGallery ItemWidth="200" ItemHeight="24" ResizeMode="Both" 
                                      MinItemsInRow="2" MaxItemsInRow="3"  Selectable="False"
                                      ItemsSource="{Binding Path=SelectedModelContextViewModel.AdditionalDiagramSurfaceModels, Mode=OneWay}"
                                      Focusable="False" MinWidth="150" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch">
                        <fluent:InRibbonGallery.ItemTemplate>
                            <DataTemplate>
                                <ribbonHelperBase:RibbonInGalleryItem IsSelectedItem="{Binding Path=IsDockingPaneVisible, Mode=OneWay}">
                                    <Button Command="{Binding Path=ShowDockingPaneCommand}" Background="Transparent" BorderThickness="0" BorderBrush="Transparent">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Margin="3,0,0,0" Text="{Binding Path=DockingPaneTitle, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left"
                                                   ToolTip="{Binding Path=DockingPaneTitle, Mode=OneWay}"/>
                                        </StackPanel>
                                    </Button>
                                </ribbonHelperBase:RibbonInGalleryItem>
                            </DataTemplate>
                        </fluent:InRibbonGallery.ItemTemplate>
                    </fluent:InRibbonGallery>
                </fluent:RibbonGroupBox>
            </fluent:RibbonTabItem>
        </ribbonHelper:EmbeddedRibbon>

        <shellCommonCtrls:ShellTabControlAvalonDock DataContext="{Binding Path=.}" Grid.Row="1" />
    </Grid>
</pluginView:DslPluginMainControl>